#include <cstdio>

const int N = 33;
int n, l, r, f[N][2][N];
bool s[N];

int solve(int x) {
  int cnt = 0, res = 0, tot0 = 0, tot1 = 1;
  while (x) s[++cnt] = x & 1, x >>= 1;
  for (int i = cnt - 1; i; --i)
    for (int j = i >> 1; ~j; --j) res += f[i][1][j];
  for (int i = cnt - 1; i; --i) {
    if (s[i]) {
      for (int j = (cnt >> 1) - tot1; j >= 0; --j) res += f[i][0][j];
      tot1++;
    } else
      tot0++;
  }
  return res;
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
  freopen("CppTest.in", "r", stdin);
  freopen("CppTest.out", "w", stdout);
#endif
#endif

  scanf("%d%d", &l, &r);
  f[1][0][0] = 1, f[1][1][1] = 1;
  for (int i = 2; i < N; ++i) {
    for (int k = 0; k < i; ++k) {
      f[i][0][k] = f[i - 1][0][k] + f[i - 1][1][k];
    }
    for (int k = 1; k <= i; ++k) {
      f[i][1][k] = f[i - 1][0][k - 1] + f[i - 1][1][k - 1];
    }
  }
  printf("%d", solve(r + 1) - solve(l));
  return 0;
}